/* 
 * File:   1002.c
 * Author: Administrator
 *
 * Created on 2014年5月6日, 下午7:21
 */

#include <stdio.h>
#include <stdlib.h>

#define FIRE_NET_SPACE  0
#define FIRE_NET_WALL   1
#define FIRE_NET_FIRE   2

int  a[16] = {0};
char b[4][4] = {0};  // in
int  d[4][4] = {0};  // judge
int  c[16] = {0};
int  n = 0;
int  f = 0;

/***
 * judge one
 */
int judgeOne(int i, int j) {
	
}

/***
 * judge all
 */
int judgeAll() {
	int i,j;
	
	for (i = 0; i < n; i++) 
		for (j = 0; j < n; j++)
			if (!judgeOne(i, j)) 
				return 0;
	return 1;
}

int fill(int *m, int len) {
	int i;
	int x,y;
	for (i = 0; i < len; i++) {
		x = m[i] / n;
		y = m[i] % n;
	}
	return 0;
}

int sort() {
	int i, j, r;
	
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			if (b[i][j] == '.') {
				a[f] = i*n+j; //mark spaces
				f++;
			}
		}
	}
	
	for (i = 1; i <= f; i++) {
		if (!fill(i)) {
			r = i - 1;
			break;
		}
	}
	
	return r;
}
	
/*
 * 
 */
int main(int argc, char** argv) {
	int  i;
    while (scanf("%d", &n) && n) {
		for (i = 0; i < n; i++)  {
			scanf("%s", &b[i][0]);
		}
		printf("%d", sort());
	}
	
    return (EXIT_SUCCESS);
}

